﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

using ClassCommon;

namespace ClassCommon
{
    /// <summary>
    /// 算法exe帮助类
    /// </summary>
    public class ArithmeticExecuteHelper
    {
        /// <summary>
        /// 执行算法exe
        /// </summary>
        /// <param name="inputFiles">输入参数(文件1,文件2)</param>
        /// <param name="outputFiles">输出参数(文件1,文件2)</param>
        public static void ExecuteArithmenticWith(string[] inputFiles, string[] outputFiles)
        {
            System.Diagnostics.Process exep = new Process();
            exep.StartInfo.FileName = ConfigSetting.Arithmetic_EXE_Path; // 算法exe路径
            // 算法需要的参数
            /*
             * 1. csv 路径
             * 2. txt 路径
             * 3. time_class.csv 路径
             * 4. time_teacher.csv 路径
             */
            string arguments = string.Format("{0} {1} {2} {3}", inputFiles[0], ConfigSetting.Arithmetic_Egao_Txt_Path, outputFiles[0], outputFiles[1]);
            exep.StartInfo.Arguments = arguments;
            //exep.StartInfo.CreateNoWindow = true;
            exep.StartInfo.UseShellExecute = false;
            exep.Start();
            exep.WaitForExit();//关键，等待外部程序退出后才能往下执行
        }

    }
}
